home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / THINKC / 5 / READER_1 / FDS__1_0 / SOUNDEDI / FORMATDR.P next >
Text File  |  1992-07-19  |  2KB  |  94 lines

  1. unit FormatDriver;
  2.  
  3. interface
  4.  
  5.     const
  6.         rmInit = 1;
  7.         rmDispose = 2;
  8.         rmOpen = 3;
  9.         rmClose = 4;
  10.         rmPrint = 5;
  11.         rmCopy = 6;
  12.         rmSelectAll = 7;
  13.         rmMenuSelect = 8;
  14.         rmMenuUpdate = 9;
  15.         rmDraw = 10;
  16.         rmResize = 11;
  17.         rmActivate = 12;
  18.         rmDeactivate = 13;
  19.         rmInContent = 14;
  20.         rmInControl = 15;
  21.         rmPrintPage = 16;
  22.  
  23.         ALRTinfo = 131;
  24.  
  25.         rmNoErr = 0;
  26.         rmError = 1;
  27.  
  28.     type
  29.         SysEnvPtr = ^SysEnvRec;
  30.  
  31.     function GetVControl (window: WindowPtr): ControlHandle;
  32.     function GetHControl (window: WindowPtr): ControlHandle;
  33.     procedure InfoAlert (strID: Integer);
  34.  
  35. implementation
  36.  
  37.     function GetVControl (window: WindowPtr): ControlHandle;
  38.         var
  39.             control: ControlHandle;
  40.             title: Str255;
  41.     begin
  42.         control := WindowPeek(window)^.controlList;
  43.         while control <> nil do
  44.             begin
  45.                 GetCTitle(control, title);
  46.                 if title = 'v' then
  47.                     begin
  48.                         GetVControl := control;
  49.                         Exit(GetVControl);
  50.                     end;
  51.                 control := control^^.nextControl;
  52.             end;
  53.         GetVControl := nil;
  54.     end;
  55.  
  56.     function GetHControl (window: WindowPtr): ControlHandle;
  57.         var
  58.             control: ControlHandle;
  59.             title: Str255;
  60.     begin
  61.         control := WindowPeek(window)^.controlList;
  62.         while control <> nil do
  63.             begin
  64.                 GetCTitle(control, title);
  65.                 if title = 'h' then
  66.                     begin
  67.                         GetHControl := control;
  68.                         Exit(GetHControl);
  69.                     end;
  70.                 control := control^^.nextControl;
  71.             end;
  72.         GetHControl := nil;
  73.     end;
  74.  
  75.     procedure InfoAlert (strID: Integer);
  76.         var
  77.             itemHit: Integer;
  78.             strHdl: StringHandle;
  79.             theStr: Str255;
  80.     begin
  81.         strHdl := GetString(strID);
  82.         if strHdl = nil then
  83.             begin
  84.                 SysBeep(0);
  85.                 Exit(InfoAlert);
  86.             end;
  87.         theStr := strHdl^^;
  88.         ReleaseResource(Handle(strHdl));
  89.         ParamText(theStr, '', '', '');
  90.         InitCursor;
  91.         itemHit := NoteAlert(ALRTinfo, nil);
  92.     end;
  93.  
  94. end.